package com.gitee.wsl.resource.font


import androidx.compose.runtime.Stable
import androidx.compose.ui.text.font.Font
import kotlinx.io.files.Path

/**
 * Used to load animation fonts. If manager returns null then glyphs or default platform font
 * will be used
 * */
@Stable
interface FontManager {

    /**
     * Load [font] by requirements
     * */
     suspend fun font(font: FontSpec): Font?

     companion object  {
         /**
          * Default font manager
          * */
         val Empty: FontManager = EmptyFontManager
     }
}

internal object EmptyFontManager : FontManager {
    override suspend fun font(font: FontSpec): Font? {
        return null
    }
}

expect suspend fun makeFont(spec: FontSpec, path: Path, bytes: ByteArray) : Font
